var myDb = require('../config/myDb');
var aesCode = require('../utils/aesCode');

function userService() {
    var self = this;

    myDb.connect();
}

userService.prototype.checkUser = function (usercode, passcode, callback) {
    var self = this;
    var password = aesCode.encrypt(usercode, passcode);
    myDb.getRow("select id,username from my_users where username=? and passcode=?", [usercode, password], function (err, row) {
        callback && callback(row);
    });
};

module.exports = userService;